<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
        "http://www.w3.org/TR/html4/loose.dtd">
<html>


<head>
    <title>Basic Custom Example</title>

{{include 'pages/base/layout.html'}}


    <script src="{{=URL('static','adminlte/plugins/datepicker/bootstrap-datepicker.js')}}"></script>
    <script src="{{=URL('static','adminlte/plugins/datepicker/locales/bootstrap-datepicker.zh-CN.js')}}"></script>
    <link rel="stylesheet" href="{{=URL('static','adminlte/plugins/datepicker/datepicker3.css')}}">

    <!--<script src="{{=URL('static','adminlte/plugins/highcharts/highcharts.js')}}"></script>-->
    <script src="{{=URL('static','adminlte/plugins/highcharts/highstock.js')}}"></script>

</head>

<script language="JavaScript">
    var policy_id
    $(document).ready(function () {
        policy_id = "{{=policy_id}}"

        Highcharts.setOptions({
            lang: {
                rangeSelectorFrom:'时间:',
                rangeSelectorTo: '-',
                shortMonths:['一月', '二月', '三月', '四月', '五月', '六月',  '七月', '八月', '九月', '十月', '十一月', '十二月'],
                rangeSelectorZoom:'缩放:'
            }
        });

//        $("#beginDatepicker").datepicker({language: 'zh-CN', format: 'yyyy-mm-dd'}).datepicker('setDate', '2016-01-01');
//        $("#endDatepicker").datepicker({language: 'zh-CN', format: 'yyyy-mm-dd'}).datepicker('setDate', '2016-12-31');
    });

    function retest() {
        parent.$("#loading").show();
        $.ajax({
            type: 'POST',
            async: false,
            dataType: "json",
            url: '{{=URL('alpha_main_v2','retest')}}',
            data: {
                'policy_id':policy_id,
                'begindate': $("#beginDatepicker").val(),
                'enddate': $("#endDatepicker").val()
            },
            success: function (data) {
                parent.$("#loading").hide();
                if (data.status == "error") {
                    alert(data.msg)
                }
                debugger;
                $('#testrow').html(data.testrow);
                $('#testchar').highcharts("StockChart",data.testchar);
            }
        });

    }

</script>
<body>

<div class='container'>
    <form class="form-inline" role="form">
        <button type="button" onclick="retest()" class="btn btn-danger">运行回测</button>

    <div class="row">
        <small><label class="col-sm-1 control-label "></label></small>
    </div>
    <div class="row">
        <small><label class="col-sm-1 control-label ">年华收益率</label></small>
        <small><label class="col-sm-1 control-label ">基准年华收益率</label></small>
        <small><label class="col-sm-1 control-label ">阿尔法</label></small>
        <small><label class="col-sm-1 control-label ">贝塔</label></small>
        <small><label class="col-sm-1 control-label ">收益波动率</label></small>
        <small><label class="col-sm-1 control-label ">信息比率</label></small>
        <small><label class="col-sm-1 control-label ">最大回撤</label></small>
        <small><label class="col-sm-1 control-label ">夏普比率</label></small>
    </div>
    <div id="testrow" class="row">
        <small><label class="col-sm-1 control-label ">0</label></small>
        <small><label class="col-sm-1 control-label ">0</label></small>
        <small><label class="col-sm-1 control-label ">0</label></small>
        <small><label class="col-sm-1 control-label ">0</label></small>
        <small><label class="col-sm-1 control-label ">0</label></small>
        <small><label class="col-sm-1 control-label ">0</label></small>
        <small><label class="col-sm-1 control-label ">0</label></small>
        <small><label class="col-sm-1 control-label ">0</label></small>
    </div>
        </form>
</div>
<div id="testchar" style="width: 98%; height: 400px; margin: 0 auto">
</div>

</body>
</html>